package com.anjho.pojo;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Entity implementation class for Entity: Page
 * 
 */
@Entity
@Table(name = "page")
@NamedQueries({ @NamedQuery(name = "Page.findByPacode", query = "SELECT p FROM Page p WHERE p.pacode = :pacode") })
public class Page implements Serializable {

	private static final long serialVersionUID = -496450448502306401L;

	@Id
	@Column(name="pacode")
	@GeneratedValue(strategy = GenerationType.SEQUENCE)
	@OneToMany(mappedBy = "page", cascade={CascadeType.PERSIST})
	private int pacode;

	@Column(name = "description", nullable = false, length = 50)
	private String description;

	public Page() {
	}

	public Page(String page) {
		this.description = page;
	}

	public int getPacode() {
		return this.pacode;
	}

	public void setPacode(int pacode) {
		this.pacode = pacode;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Page other = (Page) obj;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		return true;
	}
}
